package name.huzhenbo.java.serialization;

public abstract class AbstractFoo {

    private int x, y;

    // The parameterless constructor is required for readObject.
    // Otherwise: java.io.InvalidClassException: name.huzhenbo.java.serialization.Foo; name.huzhenbo.java.serialization.Foo; no valid constructor
    protected AbstractFoo() {
    }

    protected AbstractFoo(int x, int y) {
        this.x = x;
        this.y = y;
    }

    // make the methods final, so it cannot be inherited.
    protected final int getX() {
        return x;
    }

    protected final int getY() {
        return y;
    }

    protected final void setX(int x) {
        this.x = x;
    }

    protected final void setY(int y) {
        this.y = y;
    }
}
